/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webClient;

import engine.Singleton;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;

/**
 *
 * @author User
 */
public class WebPages {
  public String table = "rrr";
  

  public String mainWindow() throws FileNotFoundException, IOException {
 //   String str = readFile("src/webClient/example.html");
    String str = readFile("src/webClient/header.html");
    str += Singleton.table;
    str += readFile("src/webClient/footer.html");

    String addInfo = "<a href=\"?AddInfoCode\" ONCLICK=\"window.open('http://localhost:7777/informationCode','','Toolbar=0,Location=0,Directories=0,Status=0,Menubar=0,Scrollbars=0,Resizable=0,Width=650,Height=350');\">AddInfo</a>";
    if(Singleton.role != null){
        if (Singleton.role.equals("User")) {
            str = str.replace(addInfo, "");
        }
    }
    
    return str;
  }
  
  public String readFile(String filePath) throws FileNotFoundException, IOException
  {
    String line = "";
    String str;
    BufferedReader in = new BufferedReader(new FileReader(filePath));
    while ((str = in.readLine()) != null) {
      line += str;
    }
    in.close();
    System.out.println(line);
    return line;
  }
  

  
}
